package com.appkubes.fintech.restful.application.face.controller;

import com.appkubes.fintech.common.response.Response;
import com.appkubes.fintech.restful.application.face.service.IdCardAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类名: FaceOcrController
 * 描述: TODO
 * 日期: 2020/4/12 23:19
 *
 * @author Reboot65
 * @version 1.0
 **/
@Api(tags = "身份证识别")
@RestController
@RequestMapping("idcard/ocr")
@Slf4j
public class IdCardOcrController {

    @Autowired
    private IdCardAuthService idCardAuthService;

    @GetMapping("/getFrontOcrImg")
    @ApiOperation("获取正面识别图像")
    public  Response getFrontOcrImg(String orderNo,String userKey){
        return idCardAuthService.getOcrResult(orderNo,userKey,"front");
    }

    @GetMapping("/getBackOcrImg")
    @ApiOperation("获取反面识别图像")
    public  Response getBackOcrImg(String orderNo,String userKey){
        return idCardAuthService.getOcrResult(orderNo,userKey,"back");
    }

    @GetMapping("/getOcrParams")
    @ApiOperation("获取Ocr参数")
    public Response getOcrParams(@RequestParam("userKey") String userKey) {
        return idCardAuthService.getOcrParams(userKey);
    }

    @GetMapping("/idCardVerify")
    @ApiOperation("身份证验证")
    public Response idCardVerify(@RequestParam("userKey") String userKey) {
        return idCardAuthService.idCardVerify(userKey);
    }

    @GetMapping("/getOcrData")
    @ApiOperation("获取身份证识别数据")
    public Response getOcrData(@RequestParam("userKey") String userKey) {
        return idCardAuthService.getOcrData(userKey);
    }



}
